# -*- coding: utf-8 -*-
# frontend/styles/custom_css.py
import streamlit as st

def load_custom_css():
    """加载自定义CSS样式"""
    st.markdown("""
    <style>
    /* 主题色彩 */
    :root {
        --primary-color: #165DFF;
        --secondary-color: #7B61FF;
        --success-color: #00B42A;
        --warning-color: #FF7D00;
        --danger-color: #F53F3F;
        --dark-color: #1D2129;
        --light-color: #F2F3F5;
    }
    
    /* 隐藏Streamlit默认元素 */
    #MainMenu {visibility: hidden;}
    footer {visibility: hidden;}
    header {visibility: hidden;}
    
    /* 自定义按钮样式 */
    .stButton > button {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        color: white;
        border: none;
        border-radius: 10px;
        padding: 0.5rem 1rem;
        font-weight: 600;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(22, 93, 255, 0.3);
    }
    
    .stButton > button:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(22, 93, 255, 0.4);
    }
    
    /* 聊天消息样式 */
    .stChatMessage {
        background: white;
        border-radius: 15px;
        padding: 15px;
        margin: 10px 0;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    /* 输入框样式 */
    .stTextArea > div > div > textarea {
        border-radius: 10px;
        border: 2px solid #E8E8E8;
        transition: border-color 0.3s ease;
    }
    
    .stTextArea > div > div > textarea:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
    }
    
    /* 侧边栏样式 */
    .css-1d391kg {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    /* 标题样式 */
    h1, h2, h3 {
        color: var(--dark-color);
        font-weight: 700;
    }
    
    /* 加载动画 */
    @keyframes pulse {
        0% { opacity: 1; }
        50% { opacity: 0.5; }
        100% { opacity: 1; }
    }
    
    .loading {
        animation: pulse 2s infinite;
    }
    
    /* 响应式设计 */
    @media (max-width: 768px) {
        .stButton > button {
            font-size: 14px;
            padding: 0.4rem 0.8rem;
        }
    }
    
    /* 滚动条样式 */
    ::-webkit-scrollbar {
        width: 8px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 10px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: var(--secondary-color);
    }
    </style>
    """, unsafe_allow_html=True)
